home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / doors_1 / gapqbdr.zip / GAPQBDR.BI < prev    next >
Text File  |  1991-01-12  |  20KB  |  348 lines

  1. '
  2. '  Copyright (C) 1988,1989 The GAP Development Company
  3. '
  4. '  All Rights Reserved
  5. '
  6. '
  7. '  GAPQBDR.BI
  8. '
  9. '  Include file for all modules that use GAPQBDR
  10. '
  11. '
  12.  
  13. DECLARE FUNCTION keybrd% ()               ' checks if key was pressed locally
  14. DECLARE FUNCTION read.doorsys% ()         ' reads door.sys
  15. DECLARE FUNCTION open.pcb% ()             ' reads pcboard.dat
  16. DECLARE FUNCTION getakey% ()              ' gets a single character
  17. DECLARE FUNCTION a.ccess% (a$)            ' checks for file existence
  18. DECLARE FUNCTION right.trim$ (a$)         ' trims C strings
  19. DECLARE FUNCTION read.gapdos% ()          ' reads GAPDOS.DAT
  20. DECLARE FUNCTION write.gapdos% ()         ' writes GAPDOS.DAT
  21. DECLARE FUNCTION read.gapuser% ()         ' reads USERS.DAT
  22. DECLARE FUNCTION write.gapuser% ()        ' writes USERS.DAT
  23. DECLARE FUNCTION read.pcbsys% ()          ' reads PCBOARD.SYS
  24. DECLARE FUNCTION write.pcbsys% ()         ' writes PCBOARD.SYS
  25. DECLARE FUNCTION read.pcbuser% ()         ' read pcb USERS
  26. DECLARE FUNCTION write.pcbuser% ()        ' write pcb USERS
  27. DECLARE FUNCTION getrand% (low%, high%)   ' get a random number
  28. DECLARE FUNCTION read.score% (datfile$, message$)  ' read high scores
  29.  
  30. DECLARE SUB at (r.ow%, c.ol%)             ' position cursor at row, column
  31. DECLARE SUB atsay (r.ow%, c.ol%, a$)      ' position cursor and print string
  32. DECLARE SUB eraeol ()                     ' erase from cursor to end of line
  33. DECLARE SUB show.mess (message$, bell%, newline%)  ' displays a string
  34. DECLARE SUB lostcd ()                     ' used by com routines
  35. DECLARE SUB no.carrier ()                 ' shows message and calls leave
  36. DECLARE SUB write.score (datfile$, score&) ' write high scores
  37. DECLARE SUB init.time ()                  ' inits get.time variables
  38. DECLARE SUB get.string (fld$)             ' main imput routine
  39. DECLARE SUB read.cnf (f.name$)            ' reads the configuration file
  40. DECLARE SUB init.door ()                  ' initializes the door
  41. DECLARE SUB leave ()                      ' normal exit
  42. DECLARE SUB nl (how%)                     ' sends CR/LF
  43. DECLARE SUB ansi (ansicolor$)             ' shows ansi colors
  44. DECLARE SUB more ()                       ' checks for full screen
  45. DECLARE SUB pause ()                      ' waits for a keypress
  46. DECLARE SUB elap.time ()                  ' computes elapsed time
  47. DECLARE SUB backspace (num.times%)        ' erases characters
  48. DECLARE SUB time.left ()                  ' computes time left
  49. DECLARE SUB waitasec (secs%)              ' waits for x number of seconds
  50. DECLARE SUB time.credit (how%)            ' computes time credits
  51. DECLARE SUB putachar (c%)                 ' sends a single character
  52. DECLARE SUB show.file (filename$)         ' displays a text file
  53. DECLARE SUB set.status (up.date%)         ' displays status line
  54. DECLARE SUB update.clock ()               ' updates status line clock
  55. DECLARE SUB putkey (c%)                   ' sends a single character
  56. DECLARE SUB do.chat ()                    ' chat with caller
  57. DECLARE SUB pagesysop ()                  ' page sysop for chat
  58. DECLARE SUB clear.scr ()                  ' clears local and remote screen
  59. DECLARE SUB setctrlc ()                   ' ctrl-c trapper
  60. DECLARE SUB reset.port ALIAS "RESET_PORT" ()   ' restores the comm port
  61.  
  62.  
  63. CONST MOREG = "MORE - [Y]es, [N]o, [C]ontinous "
  64. CONST MOREA = "MORE - [Y]es, [N]o, [C]ontinous "
  65.  
  66. CONST MORE1G = "MORE - [Y]es, [N]o, [C]ontinous, [R]edisplay "
  67. CONST MORE1A = "MORE - [Y]es, [N]o, [C]ontinous, [R]edisplay "
  68.  
  69. CONST PAUSEG = "Press [Any Key] To Continue "
  70. CONST PAUSEA = "Press [Any Key] To Continue "
  71.  
  72. CONST YES = 1
  73. CONST NO = 0
  74.  
  75.  
  76.   '***********************************************************************
  77.   '*                         ANSI colors                                 *
  78.   '***********************************************************************
  79.  
  80. ' dim colors
  81.  
  82. CONST BLACK = ""
  83. CONST RED = ""
  84. CONST GREEN = ""
  85. CONST BROWN = ""
  86. CONST BLUE = ""
  87. CONST MAGENTA = ""
  88. CONST CYAN = ""
  89. CONST WHITE = ""
  90.  
  91. ' bright colors
  92.  
  93. CONST BBLACK = ""
  94. CONST BRED = ""
  95. CONST BGREEN = ""
  96. CONST YELLOW = ""
  97. CONST BBLUE = ""
  98. CONST BMAGENTA = ""
  99. CONST BCYAN = ""
  100. CONST BWHITE = ""
  101.  
  102. CONST REVID = ""
  103.  
  104.  
  105. '$INCLUDE: 'qb.bi'
  106.  
  107.  
  108.    '***********************************************************************
  109.    '*  global variables                                                   *
  110.    '***********************************************************************
  111.  
  112.    COMMON SHARED port       AS INTEGER     ' comm port being used
  113.    COMMON SHARED node       AS INTEGER     ' node number
  114.    COMMON SHARED s.creen    AS INTEGER     ' 0 = screen off, 1 = screen on
  115.    COMMON SHARED printer    AS INTEGER     ' 0 = printer off, 1 = printer on
  116.    COMMON SHARED bell       AS INTEGER     ' 0 = page bell off, 1 = on
  117.    COMMON SHARED alarm      AS INTEGER     ' 0 = caller alarm off, 1 = on
  118.    COMMON SHARED level      AS INTEGER     ' user's security level
  119.    COMMON SHARED minsleft   AS INTEGER     ' number of minutes left at start
  120.    COMMON SHARED c.olor     AS INTEGER     ' 0 = no color, 1 = color ok
  121.    COMMON SHARED page       AS INTEGER     ' user's page length
  122.    COMMON SHARED expert     AS INTEGER     ' 0 = novice, 1 = expert
  123.    COMMON SHARED l.ocal     AS INTEGER     ' l.ocal user flag
  124.    COMMON SHARED lines      AS INTEGER     ' # of lines currently displayed
  125.    COMMON SHARED v.iew      AS INTEGER     ' true if want a more prompt
  126.    COMMON SHARED noup       AS INTEGER     ' if 1, get.string wont upper case
  127.    COMMON SHARED do.pcb     AS INTEGER     ' if 1, then BBS system is pcboard
  128.    COMMON SHARED timeleft   AS INTEGER     ' time user has left
  129.    COMMON SHARED timecredit AS INTEGER     ' time credits for user (in mins)
  130.    COMMON SHARED realcredit AS INTEGER     ' time credits from BBS
  131.    COMMON SHARED dflt.color AS INTEGER     ' BBS default color
  132.    COMMON SHARED maxfiles   AS INTEGER     ' Max files available
  133.    COMMON SHARED curfiles   AS INTEGER     ' Current files downloaded
  134.  
  135.    COMMON SHARED maindir    AS STRING      ' path to the main directory
  136.    COMMON SHARED gendir     AS STRING      ' path to the gen directory
  137.    COMMON SHARED sysname    AS STRING      ' sysop's name
  138.    COMMON SHARED birthday   AS STRING      ' caller's birth date
  139.    COMMON SHARED bbs.dir    AS STRING      ' path to BBS default dir
  140.    COMMON SHARED board.name AS STRING      ' name of the BBS
  141.    COMMON SHARED username   AS STRING      ' caller's full name
  142.    COMMON SHARED first      AS STRING      ' caller's first name
  143.    COMMON SHARED last       AS STRING      ' caller's last name
  144.    COMMON SHARED city       AS STRING      ' home state
  145.    COMMON SHARED hphone     AS STRING      ' home phone number
  146.    COMMON SHARED bphone     AS STRING      ' voice or data phone number
  147.    COMMON SHARED password   AS STRING      ' user's password
  148.    COMMON SHARED lastdate   AS STRING      ' last date user was on
  149.    COMMON SHARED subscrip   AS STRING      ' date user's subscription expires
  150.    COMMON SHARED CRLF       AS STRING      ' carriage return and line feed
  151.    COMMON SHARED handle     AS STRING      ' caller's Handle
  152.    COMMON SHARED event.time AS STRING      ' event run time
  153.    COMMON SHARED last.new   AS STRING      ' last new files scan
  154.  
  155.    COMMON SHARED userbaud   AS LONG        ' user's bps rate
  156.    COMMON SHARED baud       AS LONG        ' DTE bps rate
  157.    COMMON SHARED timeson    AS LONG        ' number of times on
  158.    COMMON SHARED uploads    AS LONG        ' total number of uploads
  159.    COMMON SHARED downloads  AS LONG        ' total number of downloads
  160.    COMMON SHARED upbytes    AS LONG        ' total bytes uploaded
  161.    COMMON SHARED curbytes   AS LONG        ' current bytes downloaded
  162.    COMMON SHARED maxbytes   AS LONG        ' max number of bytes available
  163.    COMMON SHARED timenow    AS LONG        ' time it is now  (in secs)
  164.    COMMON SHARED starttime  AS LONG        ' time the user started (in secs)
  165.    COMMON SHARED doors.open AS LONG        ' Total doors opened
  166.    COMMON SHARED mesleft    AS LONG        ' Total messages left
  167.    COMMON SHARED downbytes  AS LONG        ' total download bytes
  168.  
  169.  
  170.    '***********************************************************************
  171.    '*  GAPDOS.DAT record structure.                                       *
  172.    '*  For those who wish to read, modify, and update the record.         *
  173.    '***********************************************************************
  174.  
  175.    TYPE GAPDOSREC
  176.       userfirst   AS STRING * 16           ' user's first name
  177.       username    AS STRING * 32           ' user's full name
  178.       userindex   AS STRING * 45           ' user's index into users.dat
  179.       callbytes   AS LONG                  ' ttl bytes available for download
  180.       starttime   AS LONG                  ' time (in secs) user logged on
  181.       minavail    AS INTEGER               ' ttl minutes available
  182.       timecredit  AS INTEGER               ' any credits the user may have
  183.       forumnum    AS INTEGER               ' forum the user is in
  184.       baud        AS INTEGER               ' DTE bps rate
  185.       port        AS INTEGER               ' port being used
  186.       colorc      AS INTEGER               ' 0 = no color, 1 = color
  187.       localc      AS INTEGER               ' 0 = user, 1 = sysop, 2 = local
  188.       givetime    AS INTEGER               ' non zero if user got more time
  189.       maxfiles    AS INTEGER               ' max number of files can dwnload
  190.       userbaud    AS INTEGER               ' user's bps rate
  191.       exitdos     AS STRING * 1            ' 1 = exit to DOS after this call
  192.       didnew      AS STRING * 1            ' 1 = did a new files scan
  193.       userlevel   AS INTEGER               ' temporary levels given
  194.       notime      AS STRING * 1            ' if 1 dont give any extra time
  195.       oldmins     AS INTEGER               ' caller's current minutes on
  196.       sysmail     AS STRING * 1            ' mail flag for sysop
  197.       joined1     AS LONG                  ' bit flags, forums joined 1-30
  198.       joined2     AS LONG                  ' bit flags, forums joined 31-60
  199.       joined3     AS LONG                  ' bit flags, forums joined 61-90
  200.    END TYPE
  201.    
  202.    COMMON SHARED gapdos AS GAPDOSREC
  203.  
  204.  
  205.    '***********************************************************************
  206.    '*  USERS.DAT record structure.                                        *
  207.    '*  The index (fname and lname) must NOT be touched!                   *
  208.    '*  STRING fields are fully padded with spaces and the last position   *
  209.    '*  of the string MUST be a 0. This means that for a field such as     *
  210.    '*  handle, you may use 15 characters of the string. The 16th position *
  211.    '*  is reserved for the chr$(0).                                       *
  212.    '*  Phone number fields must be of the type "(999)999-999"+chr$(0).    *
  213.    '*  Date fields must be of the type "01/01/01"+chr$(0).                *
  214.    '*  Note that even if a phone number or date field has no data, they   *
  215.    '*  still contain the picture clauses (IE, "(   )  -" or "  /  /")     *
  216.    '***********************************************************************
  217.  
  218.    TYPE GAPUSER
  219.       fname       AS STRING * 16           ' first name
  220.       lname       AS STRING * 16           ' last name
  221.       handle      AS STRING * 16           ' handle for MPART!
  222.       city        AS STRING * 30           ' city, state
  223.       passwd      AS STRING * 13           ' password
  224.       hphone      AS STRING * 14           ' homephone
  225.       bphone      AS STRING * 14           ' work/data phone
  226.       subscribe   AS STRING * 9            ' subscription date
  227.       level       AS INTEGER               ' security - up to 255
  228.       timeson     AS LONG                  ' times on - over 2 billion
  229.       lastdate    AS STRING * 9            ' last date on - mm/dd/yy
  230.       lasttime    AS STRING * 6            ' last time on - hh:mm
  231.       ttlmins     AS LONG                  ' total mins on - 2+ billion
  232.       minutes     AS INTEGER               ' # of minutes last call
  233.       uploads     AS LONG                  ' # of uploads - 2+ billion
  234.       downloads   AS LONG                  ' # of downloads - 2+ billion
  235.       ttlbytes    AS LONG                  ' total bytes downloaded
  236.       curbytes    AS LONG                  ' bytes downloaded this call
  237.       private     AS STRING * 1            ' allow on private nodes?
  238.       protocol    AS STRING * 3            ' transfer protocol
  239.       page        AS INTEGER               ' page length - to 23
  240.       lastdir     AS STRING * 9            ' date last looked at dir
  241.       lastmsg     AS LONG                  ' last message read - 99999 max
  242.       mesread     AS LONG                  ' total msgs read - 2+ billion
  243.       mesleft     AS LONG                  ' total messages left
  244.       joined      AS LONG                  ' total forums joined
  245.       blts        AS LONG                  ' total bulletins read
  246.       doors       AS LONG                  ' total doors opened
  247.       lastfrm     AS INTEGER               ' last forum in
  248.       expert      AS STRING * 1            ' novice = N, expert = Y
  249.       sysop       AS STRING * 1            ' sysop record, 1 = Y, 0 = N
  250.       upbytes     AS LONG                  ' total bytes uploaded
  251.       curdown     AS INTEGER               ' total files downed today
  252.       birthdate   AS STRING * 9            ' user's birthdate
  253.       comment     AS STRING * 51           ' comment about user
  254.       forum1      AS LONG                  ' forum membership  1  - 30
  255.       forum2      AS LONG                  ' forum membership  31 - 60
  256.       forum3      AS LONG                  ' forum membership  61 - 90
  257.       nu          AS STRING * 360          ' forum last msg, not provided
  258.    END TYPE                                ' 652 bytes
  259.  
  260.    COMMON SHARED user AS GAPUSER
  261.  
  262.  
  263.    '***********************************************************************
  264.    '*  PCBOARD.SYS record structure.                                      *
  265.    '*  GAPQBDR supports version 14.x ONLY!                                *
  266.    '*  Note - There is no consistency with this file. For instance, node  *
  267.    '*    number is stored as a short integer (1 byte integer), where as   *
  268.    '*    port number is stored as a 1 byte string.  Display, printer, etc *
  269.    '*    are stored as space 0 (if the function is off), where as event   *
  270.    '*    active and slide event are stored as 0 space.  Have fun!         *
  271.    '***********************************************************************
  272.  
  273.    TYPE PCBSYS14                           ' structure of PCBOARD.SYS
  274.       display     AS STRING * 2            ' display on/off -1=on,0=off
  275.       printer     AS STRING * 2            ' printer on/off -1=on,0=off
  276.       pagebell    AS STRING * 2            ' page bell      -1=on,0=off
  277.       calleralarm AS STRING * 2            ' caller alarm   -1=on,0=off
  278.       sysopnext   AS STRING * 1            ' sysop on next  N,X,space
  279.       errcorrect  AS STRING * 2            ' ecc modem      -1=yes,0=no
  280.       colorc      AS STRING * 1            ' color toggle   Y,N,7
  281.       nu          AS STRING * 1            ' node chat, not provided
  282.       baud        AS STRING * 5            ' com port bps rate
  283.       userbaud    AS STRING * 5            ' call bps rate
  284.       userrec     AS INTEGER               ' user record position
  285.       userfirst   AS STRING * 15           ' caller's first name
  286.       password    AS STRING * 12           ' users password
  287.       timeon      AS INTEGER               ' time user logged on (mins)
  288.       timeused    AS INTEGER               ' time user has used that day
  289.       ctime       AS STRING * 5            ' time user logged on hh:mm
  290.       timeallowed AS INTEGER               ' allowed time in minutes
  291.       ttlbytes    AS INTEGER               ' total bytes available /1024
  292.       forumnum    AS STRING * 1            ' forum user was in "0" = main
  293.       nu1         AS STRING * 10           ' areas been in, not provided
  294.       timegiven   AS INTEGER               ' highest forum time given
  295.       timecredit  AS INTEGER               ' time credit in minutes
  296.       nu2         AS STRING * 4            ' language being used
  297.       username    AS STRING * 25           ' name of caller
  298.       minsleft    AS INTEGER               ' minutes left for caller
  299.       node        AS STRING * 1            ' node number as short integer
  300.       event       AS STRING * 5            ' event time hh:mm
  301.       eactive     AS STRING * 2            ' event active -1=yes,0 = no
  302.       eslide      AS STRING * 2            ' slide event  -1=yes,0 = no
  303.       nu3         AS STRING * 4            ' memorized mess #, not prov
  304.       port        AS STRING * 1            ' com port, "0","1","2" in ascii
  305.       nu4         AS STRING * 2            ' not used
  306.    END TYPE
  307.  
  308.    COMMON SHARED pcbsys AS PCBSYS14
  309.  
  310.  
  311.    '***********************************************************************
  312.    '*  PCB USERS record structure.                                        *
  313.    '***********************************************************************
  314.  
  315.    TYPE PCBUSER14                          ' pcb 14 user file
  316.       username    AS STRING * 25           ' users name
  317.       city        AS STRING * 24           ' users city
  318.       passwd      AS STRING * 12           ' users password
  319.       bphone      AS STRING * 13           ' business or data phone number
  320.       hphone      AS STRING * 13           ' home phone number
  321.       lastdate    AS STRING * 6            ' Last date on as yymmdd
  322.       lasttime    AS STRING * 5            ' last time on hh:mm
  323.       expert      AS STRING * 1            ' expert mode - Y or N
  324.       protocol    AS STRING * 1            ' Protocol
  325.       nu          AS STRING * 1            ' not used
  326.       lastdir     AS STRING * 6            ' last date looked at DIR as yymmdd
  327.       level       AS STRING * 1            ' security level
  328.       timeson     AS INTEGER               ' number of times on
  329.       page        AS STRING * 1            ' page length
  330.       uploads     AS INTEGER               ' total number of uploads
  331.       downloads   AS INTEGER               ' total number of downloads
  332.       nu1         AS STRING * 70           ' cur down bytes,comments,elapsed time
  333.       regisdate   AS STRING * 6            ' registration date
  334.       nu2         AS STRING * 1            ' expired security level
  335.       lastconf    AS STRING * 1            ' last forum in
  336.       cnfregis    AS STRING * 5            ' forum registration
  337.       nu3         AS STRING * 10           ' not provided
  338.       downbytes   AS STRING * 8            ' total download bytes
  339.       upbytes     AS STRING * 8            ' total upload bytes
  340.       delete      AS STRING * 1            ' Deleted, Y = yes, N = no
  341.       lastmsg     AS STRING * 4            ' last message number read in main
  342.       lastmsg1    AS STRING * 156          ' last message read in forums
  343.       nu4         AS STRING * 15           ' not used
  344.    END TYPE
  345.  
  346.    COMMON SHARED pcbuser AS PCBUSER14
  347.  
  348.